namespace AltNetUK.Models.Inputs
{
    using System;

    public sealed class ValidationError
    {
        private string _value;

        public ValidationError(string value)
        {
            this.Value = value;
        }

        public static implicit operator string(ValidationError error)
        {
            return (null == error) ? null as string : error.ToString();
        }

        public static implicit operator ValidationError(string value)
        {
            return (null == value) ? null as ValidationError : new ValidationError(value);
        }

        public string Value
        {
            get
            {
                return this._value;
            }

            set
            {
                if (null == value)
                {
                    throw new ArgumentNullException("value");
                }
                else if (0 == value.Length)
                {
                    throw new ArgumentOutOfRangeException("value");
                }

                this._value = value;
            }
        }

        public override string ToString()
        {
            return this.Value;
        }
    }
}